﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using System.Diagnostics;
using System.IO;

namespace TasksUnitTests
{
    [TestFixture]
    class RunTestsWithCoverageAcceptance
    {
        [Test]
        [Category("Acceptance")]
        public void RunTestsWithCoverage_SuccesfulRun_CreateCoverageReportInOutputDirectory()
        {
            return;
            var info = new ProcessStartInfo();
            info.FileName = @"E:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe";
            info.Arguments = "..\\..\\TestData\\Example.xml /t:Run";
            Process msbuild = new Process();
            msbuild.StartInfo = info;
            msbuild.StartInfo.UseShellExecute = false;
            msbuild.StartInfo.RedirectStandardOutput = true;
            msbuild.Start();
            msbuild.BeginOutputReadLine();
            msbuild.OutputDataReceived += new DataReceivedEventHandler(PrintToConsole);
            msbuild.WaitForExit();

            Assert.AreEqual(0, msbuild.ExitCode);
            Assert.IsTrue(File.Exists(@"CoverageResults\ecm.exe.coverage"));
            msbuild.StartInfo = info;
        }

        private static void PrintToConsole(object sendingProcess,
            DataReceivedEventArgs outLine)
        {
            Console.WriteLine(outLine.Data);
        }

    }
}
